<template>
  <div class="detail">
    <div class="mainContent">
      <div class="content">
        <div class="title">{{contentDetail.bt}}</div>
        <p class="time">{{filterTime(contentDetail.time)}}</p>
        <div class="contentHtml" v-html="contentDetail.nr"></div>
      </div>
    </div>
  </div>
</template>

<script>
import moment from "moment"
export default {
  name: 'Detail',
  data () {
    return {
      contentDetail: {}
    }
  },
  mounted () {
    // alert(this.$route.query.id)
    if (this.$route.query.type == 1) {
      this.getNewDetail()
    } else {
      this.getBrandDetail()
    }
  },
  methods: {
    getNewDetail () {
      this.$http({
        method: 'post',
        url: this.api.POST_ARTICAL_DETAIL + '?id=' + this.$route.query.id ,
        data: {
          // pageSize: '1',
          // pageNum: '8'
        }
      }).then(res => {
        console.log(res)
        this.contentDetail = res.data.data
      })
    },
    getBrandDetail () {
      this.$http({
        method: 'post',
        url: this.api.POST_BRANDDETAIL_DETAIL + '?id=' + this.$route.query.id,
        data: {
          // pageSize: '1',
          // pageNum: '8'
        }
      }).then(res => {
        console.log(res)
        this.contentDetail = res.data.data
      })
    },
    // 格式化时间
    filterTime (val) {
      return moment(val).format('YYYY-MM-DD HH:mm:ss')
    }
  }
}
</script>

<style scoped>
.imgWrap{
  height: 100%;
  width: 100%;
}
.imgWrap img{
  height: 100%;
  width: 100%;
}
.content{
  width: 1100px;
  padding: 20px;
  box-sizing: border-box;
  margin: 30px auto;
  border: 1px #D4D8D9 solid;
}
.content .title{
  width: 100%;
  font-size: 18px;
  font-weight: 600;
    /* margin-right: 5%; */
  /* border-bottom: 1px #D4D8D9 dashed; */
  text-align: center;
  padding-bottom: 3px;
  margin-bottom: 5px;
}
.content .time{
  width: 100%;
  text-align: center;
  color: #777;
  font-size: 13px;
  line-height: 30px;
  margin-bottom: 14px;
}
.contentHtml{
  line-height: 25px;
}
</style>
